Skip to content

Conversation

chargome
Copy link
Member

Problem (kinda)

I realised that some of the logic wrapped around the cli calls in the build plugin manager can lead to some hard to debug pitfalls when combining some commands from using just the cli like sourcemaps inject. E.g. the rollup plugin for injecting debugIds also injects a sentryDebugIdIdentifier which is basically a helper for more efficiently finding the injected debugId files before uploading them. When you inject debugIds using the cli only instead, there is no sentryDebugIdIdentifier which then leads source maps not being uploaded.

Additionally the plugin manager does quite a lot of expensive file reading/writing:

  • Read bundle, extract Debug ID from a marker in its code.
  • Write a copy of the bundle with a spec-compliant //# debugId=... comment appended/replaced.
  • Find the matching sourcemap (via sourceMappingURL, file: URLs, absolute/relative paths, or adjacent .map).
  • Read sourcemap and inject debugId/debug_id fields; rewrite source paths via hook.
  • Write both files into the temp folder as {debugId}-{chunkIndex}.js[.map]
  • This temp folder is then uploaded via the cli.

Solution

This PR adds an option for skipping all these preparation tasks for uploading sourcemaps as they are repetitive tasks when we already injected the debugIds earlier using the CLI . When prepareArtifacts is set to false, no temp folder is created and no debug file preparation is done. Instead the files are uploaded directly (similar to using sentry-cli sourcemaps upload)

Hope this makes sense!

@chargome chargome self-assigned this Aug 26, 2025
@chargome chargome requested review from Lms24 and andreiborza and removed request for Lms24 August 26, 2025 18:08
@chargome chargome requested a review from Lms24 August 26, 2025 18:17
@AbhiPrasad AbhiPrasad self-requested a review August 26, 2025 18:17
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me! This opens potential to think about preparation in general (as in, maybe we can stop moving and renaming files all together). Good start!

@chargome chargome merged commit 84cbb90 into main Aug 27, 2025
23 checks passed
@chargome chargome deleted the cg-upload-cli branch August 27, 2025 19:20
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 1, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.1.1 | 4.2.0 |


## [v4.2.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#420)

- feat(core): Add `prepareArtifacts` option for uploading sourcemaps ([#794](getsentry/sentry-javascript-bundler-plugins#794))
- perf: use premove for build clean ([#792](getsentry/sentry-javascript-bundler-plugins#792))
- fix(core): Forward headers option to sentry-cli ([#797](getsentry/sentry-javascript-bundler-plugins#797))

Work in this release contributed by [@liAmirali](https://github.com/liAmirali). Thank you for your contribution!
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 2, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.1.1 | 4.3.0 |


## [v4.3.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#430)

- feat(core): Extend deploy option to allow opting out of automatic deploy creation ([#801](getsentry/sentry-javascript-bundler-plugins#801))
- feat(core): No asset globbing for direct upload ([#800](getsentry/sentry-javascript-bundler-plugins#800))


## [v4.2.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#420)

- feat(core): Add `prepareArtifacts` option for uploading sourcemaps ([#794](getsentry/sentry-javascript-bundler-plugins#794))
- perf: use premove for build clean ([#792](getsentry/sentry-javascript-bundler-plugins#792))
- fix(core): Forward headers option to sentry-cli ([#797](getsentry/sentry-javascript-bundler-plugins#797))

Work in this release contributed by [@liAmirali](https://github.com/liAmirali). Thank you for your contribution!
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Sep 2, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 4.1.1 | 4.3.0 |


## [v4.3.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#430)

- feat(core): Extend deploy option to allow opting out of automatic deploy creation ([#801](getsentry/sentry-javascript-bundler-plugins#801))
- feat(core): No asset globbing for direct upload ([#800](getsentry/sentry-javascript-bundler-plugins#800))


## [v4.2.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#420)

- feat(core): Add `prepareArtifacts` option for uploading sourcemaps ([#794](getsentry/sentry-javascript-bundler-plugins#794))
- perf: use premove for build clean ([#792](getsentry/sentry-javascript-bundler-plugins#792))
- fix(core): Forward headers option to sentry-cli ([#797](getsentry/sentry-javascript-bundler-plugins#797))

Work in this release contributed by [@liAmirali](https://github.com/liAmirali). Thank you for your contribution!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants